<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form class="layui-form layui-col-space5" action="/admin/log" method="get" >

                        <div class="layui-inline layui-show-xs-block">
                            <input class="layui-input"  autocomplete="off" placeholder="开始日期" name="start" id="start" value="{{.start_date}}">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <input class="layui-input"  autocomplete="off" placeholder="截止日期" name="end" id="end" value="{{.end_date}}">
                        </div>

                        <div class="layui-inline layui-show-xs-block">
                            <input type="text" name="keyword"  placeholder="搜索" autocomplete="off" value="{{.keyword}}" class="layui-input">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
                        </div>
                    </form>
                </div>
                <div class="layui-card-body ">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>用户名</th>
                            <th>URL</th>
                            <th>IP</th>
                            <th>Browser</th>
                            <th>创建时间</th>
                        </thead>
                        <tbody>
                        {{range .list}}
                            <tr>
                                <td>{{.Id}}</td>
                                <td>{{.Username}}</td>
                                <td>{{.Url}}</td>
                                <td>{{.Ip}}</td>
                                <td>{{.Useragent}}</td>
                                <td>{{date .CreatedAt "Y-m-d H:i:s"}}</td>
                            </tr>
                        {{end}}
                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body ">
                    {{str2html .paginator}}
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var form = layui.form;

        //执行一个laydate实例
        laydate.render({
            elem: '#start', //指定元素
            type: 'datetime'
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end', //指定元素
            type: 'datetime'
        });
    })
    /*用户-停用*/
    function member_stop(obj,id,status){
        layer.confirm("确认要执行此操作吗？",function(index){
            request_post('/admin/sys/update_status',{id:id}).then(function (data) {
                if(data.status == 1){
                    $(obj).addClass('layui-btn-normal').removeClass("layui-btn-warm").html("已启用")
                }else{
                    $(obj).addClass('layui-btn-warm').removeClass("layui-btn-normal").html("已禁用")
                }
            },function (error) {
                msg_error(error.msg)
            })
            layer.close(index)
        })
    }
</script>
